# include <iostream>
# include <vector>
# include <iomanip>
using namespace std;

//int main()
//{
//    int m, n;
//    while (cin >> m >> n && !(m == -1 && n == -1))
//    {
//        vector<int> food(n);
//        vector<int> java(n);
//        vector<vector<int>> res(n + 1, vector<int>(m));
//        for (int i = 0; i < n; ++i)
//        {
//            cin >> java[i] >> food[i];
//        }
//        for (int i = 0; i < m; ++i)
//        {
//            res[0][m] = 0;
//        }
//        for (int i = 1; i < n + 1; ++i)
//        {
//            for (int j = 0; j < m; ++j)
//            {
//                res[i][j] = res[i - 1][j];
//                if (j >= java[i - 1])
//                    res[i][j] = max(res[i][j], res[i - 1][j - java[i - 1]] + food[i - 1]);
//            }
//        }
//        cout << fixed << setprecision(3) << res[n][m - 1] << endl;
//    }
//    return 0;
//}


//看似是普通的背包问题实际上是用贪心解决的(背包不能用贪心是因为基于性价比的贪心不一定充分利用空间(见evernote)，而这题可以部分交换)
struct food
{
    double j;
    double f;
    double eve;
};
bool cmp(food f1, food f2)
{
    return f1.eve > f2.eve;
}
int main()
{
    int m, n;
    while (cin >> m >> n && !(m == -1 && n == -1))
    {
        double result = 0;
        double sumfood = m;
//        vector<food> food(n);
        vector<food> food;
        double j;
        double f;
        for (int i = 0; i < n; ++i)
        {
            cin >> j >> f;
            if(f == 0){
                result += j;
                continue;
            }
            food.push_back({j, f, j / f});
        }
        sort(food.begin(), food.end(), cmp);
        for (int i = 0; i < food.size(); ++i)
        {
            if (sumfood <= food[i].f)
            {
                result += food[i].eve * sumfood; //单位换单位
                break;
            }
            result += food[i].j;
            sumfood -= food[i].f;
        }
//        cout << fixed << setprecision(3) << result << endl; WA???
        printf("%.3lf\n",result);
    }
    return 0;
}
